package com.ssm.basis.web.aop.log;

import com.ssm.basis.service.util.SpringHelper;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;

@Slf4j
@Aspect
// @Component
class SysLogAspect {
    @Around("@annotation(sysLog)")
    Object around(ProceedingJoinPoint point, SysLog sysLog) throws Throwable {
        String strClassName = point.getTarget().getClass().getName();
        String strMethodName = point.getSignature().getName();
        log.debug("[类名]: {}, [方法]: {}", strClassName, strMethodName);
        SpringHelper.publishEvent(new SysLogEvent(sysLog));
        return point.proceed();
    }
}
